<?php

use App\Http\Controllers\AuthController;
use App\Http\Controllers\TopicController;
use App\Http\Controllers\VideoController;
use App\Models\Post;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });

Route::resource('topic', TopicController::class)->except(['create', 'edit']);


Route::group(['prefix' => 'posts'], function () {
    Route::get('/', [\App\Http\Controllers\Api\PostController::class, 'index'])->name('posts.index');
    Route::get('/{post}', [\App\Http\Controllers\Api\PostController::class, 'show'])->name('posts.show');
    Route::get('/{post}/edit', [\App\Http\Controllers\Api\PostController::class, 'edit'])->name('posts.edit');
});

Route::middleware([
    'auth:sanctum',
    config('jetstream.auth_session'),
    'verified'
])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
});
